<%-- 
    Document   : chovoucher
    Created on : Oct 8, 2011, 10:10:18 AM
    Author     : Thu Huong
--%>

<%@page import="java.util.Calendar"%>
<%@page import="dao.*"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="pojo.*"%>
<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<link rel="stylesheet" type="text/css" href="scripts/vouchers.css">
<script language="javascript" type="text/javascript" src="scripts/vouchers.js"></script>
<% 
    BanTinDao dao = new BanTinDao();
    List<BanTinPoJo> dsBanTin = dao.TimBanTin(-1, -1, -1, -1);
%>
    
<div id="content-container">
                <div id="bread-crumb">
                    Bạn đang xem <strong>Tất cả</strong> các danh mục giảm giá<ul id="menu_location"><li><span> trên <strong>Toàn quốc <span class="expand-link">▼</span></strong></span><ul class="menu_items view-mode-list"><li><a href="http://www.giamua.com/vouchers/?l=hcm">Tp. Hồ Chí Minh</a></li><li><a href="http://www.giamua.com/vouchers/?l=ha-noi">Hà Nội</a></li></ul></li></ul><div id="filter-link"><a href="http://www.giamua.com/vouchers/?l=&amp;m=nwt">Mới đăng</a><span class="filter-seperator"> | </span><span class="filter-selected-item">Mới cập nhật</span></div>
                </div>
                <div id="search-box">
                    <div id="search-box-content">
                        <div id="gm_search">
                            <input id="query" maxlength="50" type="text">
                            <button id="search_btn" class="minibutton minibutton-main"><span>Tìm voucher</span></button>
                            <div id="search_keyword">
                                Vd: <a href="http://www.giamua.com/search.aspx?query=lau+bang+chuyen">lau bang chuyen</a>, <a href="http://www.giamua.com/search.aspx?query=du+lich+phan+thiet">du lich phan thiet</a>, <a href="http://www.giamua.com/search.aspx?query=yogurt">yogurt</a>, ...
                            </div>
                        </div>
                    </div>
                </div>
                <div id="content-container-top"></div>
                <div id="content-list">
                    <div class="pane-caption">
                        CHỢ VOUCHER 
                        <ul id="menu_voucher_type"><li><a href="" onclick="javascript:set_voucher_type(2);return false;">Cần bán</a><span class="voucher-type-separator"> |</span></li><li><a href="" onclick="javascript:set_voucher_type(1);return false;">Cần mua</a><span class="voucher-type-separator"> |</span></li><li><span class="voucher-type-selected">Tất cả</span></li></ul>
                    </div>
                    
                        <div id="list-container">
                           <%
                    for(int i=0;i<dsBanTin.size();i++)
                    {
                        BanTinPoJo banTin=dsBanTin.get(i);
                        KhuVucPoJo khuVuc=banTin.getKhuVuc();
                        int soBinhLuan=BinhLuanDao.LaySoDongTheoBanTin(banTin.getidBanTin());
                        java.util.Calendar endCal = Calendar.getInstance();
                        java.util.Calendar nowCal = Calendar.getInstance();
                        
                        endCal.setTime(banTin.getngayHetHan());
                        nowCal.setTime(new java.util.Date());
                        
                        long dif = nowCal.getTimeInMillis() - endCal.getTimeInMillis();
                        long difSeconds = dif/1000;
                          
                        
                    %> 
                            <div class="item-detail">
                                <h2 class="item-detail-title">
                                    <img src="chovoucher_files/sell-icon.png" style="margin-right: 5px;"/>
                                        <a class="link-detail" href="http://www.giamua.com/coupon/14119"><%=banTin.gettieuDe()%></a></h2>
                                <div class="item-detail-info">
                                    <div class="item-detail-info-left"><span class="address"><strong><%=khuVuc.getTenKhuVuc()%></strong></span>
                                        <span class="voucher-detail-info-separator"> | </span>
                                        <span timeleft=<%=difSeconds%> class="timeremain time">13 ngày 23 giờ 54 phút 37 giây</span></div>
                                        <div class="item-detail-info-right"><%=banTin.getGiaBan()%>đ</div></div><div class="clear"></div>
                                        <div class="item-detail-content">
                                            <img class="image-content" src="image_chozoi/<%=banTin.getHinhAnh()%>" alt="Sách tiếng pháp Delf A1, A2: cần bán"/>
                                            <p class="text-content"> <%=banTin.getnoiDung()%> </p>
                                            <div class="text-source">
                                                <table style="width: 596px;" cellpadding="0" cellspacing="0">
                                                    <tbody>
                                                        <tr>
                                                            <td style="width: 16px;">
                                                                <img src="images/user-icon.png" alt="Gởi bởi: chambre">
                                                            </td>
                                                            <td style="padding-left: 5px;">
                                                                <a href="http://www.giamua.com/user/chambre">
                                                                    <span class="voucher-user-info">chambre</span>
                                                                </a>
                                                                <span class="voucher-user-info-separator"> | </span>
                                                                <span class="voucher-count-view">3 ngày trước</span>
                                                                <span class="voucher-user-info-separator"> | </span>
                                                        <span class="voucher-count-view">Xem: <strong><%=banTin.getLuotXem()%></strong></span>
                                                        <span class="voucher-user-info-separator"> | </span><a class="voucher-comment" href="http://www.giamua.com/coupon/14119">Bàn luận</a>: <strong><%=soBinhLuan%></strong></td></tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                                        <div class="clear"></div></div>
                                                        <div class="item-detail">
                                                            <div class="item-detail-content"><p class="text-content-no-img">&nbsp;</p><div class="text-source-no-img"></div></div><div class="clear"></div>
                                                            
                                                        </div>
                                                        <%}%> 
                                                        <div id="pagination"><span>1</span> 
                                                            <a href="http://www.giamua.com/vouchers/?si=10">2</a> <a href="http://www.giamua.com/vouchers/?si=20">3</a>
                                                            <a href="http://www.giamua.com/vouchers/?si=30">4</a> 
                                                            <a href="http://www.giamua.com/vouchers/?si=40">5</a> 
                                                            <a class="nav" href="http://www.giamua.com/vouchers/?si=10">Tiếp »</a></div>
                        &nbsp;
                        <div class="clear"></div>
                        
                    </div>
                </div>
                       
                <div id="content-container-bottom"></div>
            </div>